package com.zkthink.ceres.promotion.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.zkthink.base.R;
import com.zkthink.base.request.PageParams;
import com.zkthink.ceres.promotion.dto.SalesAuditDTO;
import com.zkthink.ceres.promotion.dto.SalesCustomerPageDTO;
import com.zkthink.ceres.promotion.dto.SalesCustomerUpdateDTO;
import com.zkthink.ceres.promotion.dto.SalesPageDTO;
import com.zkthink.ceres.promotion.dto.SalesUpdateDTO;
import com.zkthink.ceres.promotion.service.SalesCustomerService;
import com.zkthink.ceres.promotion.vo.admin.SalesCustomerAdminPageVO;
import com.zkthink.security.annotation.PreAuth;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


/**
 * <p>
 * 前端控制器 客户关系
 * </p>
 *
 * @author kellen
 * @date 2020-08-22
 */
@Slf4j
@Validated
@RestController
@RequestMapping("/salesCustomer")
@Api(value = "客户关系", tags = "客户关系")
@PreAuth(replace = "salesCustomer:")
@AllArgsConstructor
public class SalesCustomerController {

    private SalesCustomerService salesCustomerService;


    /**
     * 分页查询客户关系
     */
    @ApiOperation("分页查询客户关系")
    @PostMapping("/page")
    public R<IPage<SalesCustomerAdminPageVO>> page(@RequestBody PageParams<SalesCustomerPageDTO> params) {
        return R.success(salesCustomerService.page(params));
    }


    /**
     * 更新操作
     */
    @ApiOperation("更新操作")
    @PostMapping("/update")
    public R update(@RequestBody @Validated SalesCustomerUpdateDTO updateDTO) {
        return salesCustomerService.updateCustomer(updateDTO);
    }



}
